package com.managementSystem.client.view;

import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.DecoratorPanel;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.HasValue;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.PasswordTextBox;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;
import com.managementSystem.client.presenter.RegisterPresenter;

public class RegisterView extends Composite implements RegisterPresenter.Display {
	public RegisterView() {
		DecoratorPanel contentTableDecorator = new DecoratorPanel();
		initWidget(contentTableDecorator);
		contentTableDecorator.setWidth("100%");
		contentTableDecorator.setWidth("18em");
		
		contentTable = new FlexTable();
		contentTable.setWidth("100%");
		contentTable.getCellFormatter().addStyleName(0, 0, "contacts-ListContainer");
		contentTable.getCellFormatter().setWidth(0, 0, "100%");
		contentTable.getFlexCellFormatter().setVerticalAlignment(0, 0, DockPanel.ALIGN_MIDDLE);
		contentTable.setWidget(0, 0, IdLabel);
		contentTable.setWidget(0, 1, IdBox);
		contentTable.setWidget(1, 0, fNameLabel);
		contentTable.setWidget(1, 1, fNameBox);
		contentTable.setWidget(2, 0, lNameLabel);
		contentTable.setWidget(2, 1, lNameBox);
		contentTable.setWidget(3, 0, uNameLabel);
		contentTable.setWidget(3, 1, uNameBox);
		contentTable.setWidget(4, 0, emailLabel);
		contentTable.setWidget(4, 1, emailBox);
		contentTable.setWidget(5, 0, password1Label);
		contentTable.setWidget(5, 1, password1Box);
		contentTable.setWidget(6, 0, password2Label);
		contentTable.setWidget(6, 1, password2Box);
		contentTable.setWidget(7, 0, pNumLabel);
		contentTable.setWidget(7, 1, pNumBox);
		contentTable.setWidget(8, 0, sNumLabel);
		contentTable.setWidget(8, 1, sNumBox);
		contentTable.setWidget(9, 0, typeLabel);
		contentTable.setWidget(9, 1, typeBox);
		contentTable.setWidget(10, 1, button);
		contentTableDecorator.add(contentTable);
	}

	@Override
	public Widget asWidget() {
		return this;
	}

	@Override
	public HasValue<String> getEmail() {
		return this.emailBox;
	}

	@Override
	public HasValue<String> getFirstName() {
		return this.fNameBox;
	}

	@Override
	public HasValue<String> getID() {
		return this.IdBox;
	}

	@Override
	public HasValue<String> getLastName() {
		return this.lNameBox;
	}

	@Override
	public HasValue<String> getPassword() {
		return this.password1Box;
	}

	@Override
	public HasValue<String> getPnum() {
		return this.pNumBox;
	}

	@Override
	public HasValue<String> getSnum() {
		return this.sNumBox;
	}

	@Override
	public HasClickHandlers getSubmitButton() {
		return this.button;
	}

	@Override
	public HasValue<String> getType() {
		return this.typeBox;
	}

	@Override
	public HasValue<String> getUserName() {
		return this.uNameBox;
	}
	
	private Label IdLabel = new Label("ID:");
	private TextBox IdBox = new TextBox();
	private Label fNameLabel = new Label("FirstName:");
	private TextBox fNameBox = new TextBox();
	private Label lNameLabel = new Label("LastName:");
	private TextBox lNameBox = new TextBox();
	private Label uNameLabel = new Label("UserName:");
	private TextBox uNameBox = new TextBox();
	private Label emailLabel = new Label("Email:");
	private TextBox emailBox = new TextBox();
	private Label password1Label = new Label("Password:");
	private PasswordTextBox password1Box = new PasswordTextBox();
	private Label password2Label = new Label("Password(Re-type):");
	private PasswordTextBox password2Box = new PasswordTextBox();
	private Label pNumLabel = new Label("Primary Number:");
	private TextBox pNumBox = new TextBox();
	private Label sNumLabel = new Label("Secondary number:");
	private TextBox sNumBox = new TextBox();
	private Label typeLabel = new Label("Type:");
	private TextBox typeBox = new TextBox();
	private Button button = new Button("Submit");
	private FlexTable  contentTable;
}
